import React from 'react'
import Redirect from 'umi/redirect'
import { connect } from 'dva'

export default connect(({user})=>({user}))(function PrivateRoute(props) {
    const { histort, route } = props
    if (!props.user.username) {
        return <Redirect to="/login" />
    }
    return (
        props.children
    )
})
